<!DOCTYPE html>
<html lang="en-gb" dir="ltr">

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Grid Parallax - UIkit tests</title>
        <script src="js/test.js"></script>
        <style>

            .uk-panel { height: 300px; }

            :nth-child(5n-4) > .uk-panel { background: rgba(0,0,0,0.2); }
            :nth-child(5n-3) > .uk-panel { background: rgba(0,0,0,0.3); }
            :nth-child(5n-2) > .uk-panel { background: rgba(0,0,0,0.4); }
            :nth-child(5n-1) > .uk-panel { background: rgba(0,0,0,0.5); }
            :nth-child(5n) > .uk-panel { background: rgba(0,0,0,0.6); }

            .test { background: rgba(0,0,0,0.05); }

            .js-grid-parallax :nth-child(9n-8) > .uk-panel { height: 240px; background: rgba(0,0,0,0.1); }
            .js-grid-parallax :nth-child(9n-7) > .uk-panel { height: 380px; background: rgba(0,0,0,0.1); }
            .js-grid-parallax :nth-child(9n-6) > .uk-panel { height: 400px; background: rgba(0,0,0,0.1); }
            .js-grid-parallax :nth-child(9n-5) > .uk-panel { height: 480px; background: rgba(0,0,0,0.15); }
            .js-grid-parallax :nth-child(9n-4) > .uk-panel { height: 260px; background: rgba(0,0,0,0.2); }
            .js-grid-parallax :nth-child(9n-3) > .uk-panel { height: 400px; background: rgba(0,0,0,0.25); }
            .js-grid-parallax :nth-child(9n-2) > .uk-panel { height: 450px; background: rgba(0,0,0,0.3); }
            .js-grid-parallax :nth-child(9n-1) > .uk-panel { height: 520px; background: rgba(0,0,0,0.35); }
            .js-grid-parallax :nth-child(9n) > .uk-panel { height: 280px; background: rgba(0,0,0,0.35); }

        </style>
    </head>

    <body>

        <div class="uk-container">

            <h1>Grid Parallax</h1>

            <h2>3 Columns</h2>

            <div class="test">
                <div class="uk-child-width-1-3@m" uk-grid="parallax: 150">
                    <div>

                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>

                    </div>
                    <div>

                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>

                    </div>
                    <div>

                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>
                        <div class="uk-panel uk-grid-margin"></div>

                    </div>
                </div>
            </div>

            <h2>Multi-row</h2>

            <div class="test">
                <div class="uk-child-width-1-2@ uk-child-width-1-3@m uk-child-width-1-3@l" uk-grid="parallax: 150">
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                    <div><div class="uk-panel"></div></div>
                </div>
            </div>

            <h2>With Masonry</h2>

            <div class="uk-margin uk-form-stacked">
                <div class="uk-inline">
                    <label class="uk-form-label" for="js-parallax-switcher">Parallax</label>
                    <input id="js-parallax-switcher" class="uk-input uk-form-width-small" type="text" value="0">
                </div>
                <div class="uk-inline">
                    <label class="uk-form-label" for="js-parallax-start-switcher">Start</label>
                    <input id="js-parallax-start-switcher" class="uk-input uk-form-width-small" type="text" value="0">
                </div>
                <div class="uk-inline">
                    <label class="uk-form-label" for="js-parallax-end-switcher">End</label>
                    <input id="js-parallax-end-switcher" class="uk-input uk-form-width-small" type="text" value="0">
                </div>
                <div class="uk-inline">
                    <label class="uk-form-label" for="js-parallax-justify-switcher">Justify</label>
                    <select id="js-parallax-justify-switcher" class="uk-select uk-form-width-small">
                        <option value="false">False</option>
                        <option value="true" selected>True</option>
                    </select>
                </div>
                <div class="uk-inline">
                    <label class="uk-form-label" for="js-masonry-switcher">Masonry</label>
                    <select id="js-masonry-switcher" class="uk-select uk-form-width-small">
                        <option value="pack">Pack</option>
                        <option value="next">Next</option>
                    </select>
                </div>
            </div>

            <div class="test" style="margin-bottom: 100vh">
                <div class="uk-child-width-1-2@s uk-child-width-1-3@m uk-child-width-1-4@l uk-light js-grid-parallax" uk-grid parallax="0" parallax-justify="true" masonry="pack">
                    <div><div class="uk-panel"><h1 class="uk-position-center">1</h1></div></div>
                    <div><div class="uk-panel"><h1 class="uk-position-center">2</h1></div></div>
                    <div><div class="uk-panel"><h1 class="uk-position-center">3</h1></div></div>
                    <div><div class="uk-panel"><h1 class="uk-position-center">4</h1></div></div>
                    <div><div class="uk-panel"><h1 class="uk-position-center">5</h1></div></div>
                    <div><div class="uk-panel"><h1 class="uk-position-center">6</h1></div></div>
                    <div><div class="uk-panel"><h1 class="uk-position-center">7</h1></div></div>
                    <div><div class="uk-panel"><h1 class="uk-position-center">8</h1></div></div>
                    <div><div class="uk-panel"><h1 class="uk-position-center">9</h1></div></div>
                    <div><div class="uk-panel"><h1 class="uk-position-center">10</h1></div></div>
                    <div><div class="uk-panel"><h1 class="uk-position-center">11</h1></div></div>
                    <div><div class="uk-panel"><h1 class="uk-position-center">12</h1></div></div>
                </div>
            </div>

        </div>

        <script>
            const {attr, $$, on} = UIkit.util;

            on('#js-parallax-switcher', 'change', e =>
                attr($$('.js-grid-parallax'), 'parallax', e.target.value)
            );

            on('#js-parallax-start-switcher', 'change', e =>
                attr($$('.js-grid-parallax'), 'parallax-start', e.target.value)
            );

            on('#js-parallax-end-switcher', 'change', e =>
                attr($$('.js-grid-parallax'), 'parallax-end', e.target.value)
            );

            on('#js-parallax-justify-switcher', 'change', e =>
                attr($$('.js-grid-parallax'), 'parallax-justify', e.target.value)
            );

            on('#js-masonry-switcher', 'change', e =>
                attr($$('.js-grid-parallax'), 'masonry', e.target.value)
            );

        </script>

    </body>
</html>
